package org.example.controller;

import com.qidian.common.pojo.MESResult;
import com.qidian.mes.pojo.Defect;
import com.qidian.mes.pojo.Iqc;
import com.qidian.mes.pojo.TemplateIndex;
import org.example.service.IqcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 严伟伦
 * @Company 无
 * @Description
 * @Date: 2024/10/23 11:39
 */
@RestController
@RequestMapping("/iqc")
@CrossOrigin
public class IqcController {
    @Autowired
    private IqcService iqcService;
    @GetMapping("/list")
    public MESResult selectByPage(Iqc iqc, @RequestParam(defaultValue = "1")int page, @RequestParam(defaultValue = "10")int limit){
        return iqcService.selectByPage(iqc,page,limit);
    }

    @PostMapping("/add")
    public MESResult addIqc(@RequestBody Iqc iqc){
        System.out.println("1111111111111111111111111111" + iqc);
        return iqcService.addIqc(iqc);
    }

    @GetMapping("/selectIqcById")
    public MESResult selectIqcById(@RequestParam("iqcId") int iqcId){

        return iqcService.selectIqcById(iqcId);
    }
    @PutMapping("/update")
    public MESResult updateIqc(@RequestBody Iqc iqc){

        return iqcService.updateIqc(iqc);
    }
}
